home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume4 / mailsplit2 < prev    next >
Encoding:
Internet Message Format  |  1989-02-03  |  22.6 KB

  1. Path: xanth!mcnc!rutgers!ucsd!ames!necntc!ncoast!allbery
  2. From: wyle@lavi.uucp
  3. Newsgroups: comp.sources.misc
  4. Subject: v04i001: mailsplit 2.0 release
  5. Message-ID: <8807251058.AA19194@lavi.uucp>
  6. Date: 2 Aug 88 01:11:51 GMT
  7. Sender: allbery@ncoast.UUCP
  8. Reply-To: wyle@lavi.uucp
  9. Lines: 724
  10. Approved: allbery@ncoast.UUCP
  11.  
  12. Posting-number: Volume 4, Issue 1
  13. Submitted-by: "A. Nonymous" <wyle@lavi.uucp>
  14. Archive-name: mailsplit2
  15.  
  16. [Apologies for the delays -- you very nearly lost a moderator over the past
  17. week, due to internal politics on ncoast.  Sigh.  ++bsa]
  18.  
  19. Here is mailsplit 2.0.  It has flags, options, buzzers, whistles, checks,
  20. debug options, a man page, etc.  Enjoy it, and please send me bugs,
  21. comments, suggestions.  Pass it on.
  22.  
  23. #! /bin/sh
  24. # This is a shell archive, meaning:
  25. # 1. Remove everything above the #! /bin/sh line.
  26. # 2. Save the resulting text in a file.
  27. # 3. Execute the file with /bin/sh (not csh) to create:
  28. #    README
  29. #    mailsplit
  30. #    mailsplit.1
  31. #    undoc
  32. # This archive created: Mon Jul 25 11:51:12 1988
  33. export PATH; PATH=/bin:/usr/bin:$PATH
  34. if test -f 'README'
  35. then
  36.     echo shar: "will not over-write existing file 'README'"
  37. else
  38. cat << \SHAR_EOF > 'README'
  39. mailsplit sends files and/or directories via e-mail using tar,
  40. compress, etc.  It sends an awk-script to re-assemble the pieces at the
  41. receiving side.  It is useful for sending directories and large images
  42. around when you don't have ftp, or you have to cross e-mail network
  43. boundaries.
  44.  
  45. It is a Bourne-shell script.  Read the over-blown man-page.  Send me
  46. ideas for improvements, bug reports.
  47.  
  48. -Mitch  (wyle@ethz.uucp)
  49. SHAR_EOF
  50. fi
  51. if test -f 'mailsplit'
  52. then
  53.     echo shar: "will not over-write existing file 'mailsplit'"
  54. else
  55. cat << \SHAR_EOF > 'mailsplit'
  56. #! /bin/sh
  57. #
  58. # mailsplit:     A tarmail variant  -M F Wyle 1988-
  59. #
  60. # @(#)mailsplit    2.1    88/07/25
  61.  
  62. ME=`/usr/bin/basename $0`
  63. SP=/usr/bin/split
  64. LI=700
  65. CM="$0 $*"
  66. VE="2.1  88/07/25"
  67. MA=/usr/ucb/Mail
  68. FC=0
  69. DE=0
  70. DB=5
  71. MF=""
  72. SU="_default_"
  73. TM=false
  74. FL=""
  75. ne="FL=$FL@"
  76. TO=""
  77. UU=uuencode
  78. TD=/tmp
  79. TA=tar
  80. CO=compress
  81. RA=all
  82.  
  83. umask 0
  84.  
  85. for AR in $* ; do
  86.   case $AR in
  87.     -C  ) ne="CO=" ;;
  88.     -D  ) ne="TD=" ;;
  89.     -M  ) ne="MF=" ;;
  90.     -T  ) ne="TA=" ;;
  91.     -V  ) DB=9 ;;
  92.     -d  ) ne="DE=" ;;
  93.     -l  ) ne="LI=" ;;
  94.     -m  ) ne="MA=" ;;
  95.     -n  ) TM=true ;;
  96.     -r  ) ne="RA=" ;;
  97.     -s  ) ne="SU=" ;;
  98.     -t  ) TM=true ;;
  99.     -v  ) echo "$ME version $VE by Mitch Wyle" ;  exit 0 ;;
  100.     -x* ) DB=`echo $AR | cut -c3` ; DB=${DB:-0} ;;
  101.     -u  ) ne="UU=" ;;
  102.     -*  ) echo " " ; echo "Bad flag for $ME": $AR
  103.           echo "Usage:    $ME  [<options>] <mailpath> <file(s)>"
  104.           echo "Example:  $ME  werner@utastro.uucp ./german_lessons"
  105.           echo " "
  106.           exit 0  ;;
  107.     *   ) eval $ne"$AR" ; ne="FL=$FL@" ;;
  108.   esac
  109. done
  110. case $# in
  111.   0 | 1 )
  112.     echo " "
  113.     echo "Usage:    $ME  [<options>] <mailpath> <file(s)>"
  114.     echo "Example:  $ME  werner@utastro.uucp german_lessons"
  115.     echo " "
  116.     exit 0  ;;
  117. esac
  118. IFS=@
  119. set $FL
  120. TO=$1
  121. case $SU in
  122.   _default_ ) SU=$2 ;;
  123. esac
  124.  
  125. case $DB in
  126.   8|9) set -x ;;
  127. esac
  128.  
  129. T1=$TD/1sp$$
  130. T2=$TD/2sp$$
  131. T3=$TD/3sp$$
  132.  
  133. case $RA in
  134.   all) ;;
  135.   *  )
  136.    R=""
  137.    RA=`echo $RA | sed 's/,/\@/'`
  138.    for tok in $RA ; do
  139.      if echo $tok | grep -s '\-' ; then
  140.        t=`echo $tok | sed 's/-/@-@/'`
  141.        set $t
  142.        i=$1
  143.        max=${3:-99}
  144.        while test $i -le $max ; do
  145.          R=$R"@"$i
  146.          i=`expr $i+1`
  147.        done
  148.      else
  149.        R=$R"@"$tok
  150.      fi
  151.      RA=$R
  152.    done ;;
  153. esac
  154.  
  155. case $DB in
  156.   5|6|7|8|9) echo "beginning tar and compress..." ;;
  157. esac
  158. set $FL ; shift
  159. for i in $* ; do
  160.   if test -s $i ; then
  161.     FC=`expr $FC + 1`
  162.   fi
  163. done
  164. if test $FC -gt 0 ; then
  165.   case $DB in
  166.     1|2|3|4) 
  167.       case $TM in
  168.         true )
  169.           echo "would have issued command:"
  170.           echo "$TA cvf - $* 2> /dev/null | $CO >$T1" ;;
  171.         false)  $TA cvf - $* 2> /dev/null | $CO >$T1 ;;
  172.         *    ) echo "Sigh... Programmer error in $ME at line 93." ;;
  173.       esac ;;
  174.     *) 
  175.       case $TM in
  176.        true )
  177.          echo "would have issued command:"
  178.          echo "$TA cvf - $* | $CO >$T1" ;;
  179.        false) $TA cvf - $* | $CO >$T1 ;;
  180.        *    ) echo "Sigh... Programmer error in $ME at line 101." ;;
  181.       esac ;;
  182.   esac
  183. else
  184. case $DB in
  185.   [5-9] ) echo "...whoops!  Nothing to send!  Punting..." 1>&2 ;;
  186. esac
  187.   exit 1
  188. fi
  189. case $DB in
  190.   5|6|7|8|9) echo "...finished tar, compress, starting uuencode..."
  191. esac
  192. case $TM in
  193.   true )
  194.     echo "would have issued command:"
  195.     echo "$UU $T1 $T1 > $T2 " ;;
  196.   false) $UU $T1 $T1 > $T2 ; ;;
  197.   *    ) echo "Sigh... Programmer error in $ME at line 118." ;;
  198. esac
  199. case $DB in
  200.   5|6|7|8|9) echo "...finished uuencode, starting split..."
  201. esac
  202. case $TM in 
  203.   true )
  204.     echo "would have issued command:" 
  205.     echo "$SP -$LI $T2 $T3" ;; 
  206.   false)  $SP -$LI $T2 $T3 ; ;; 
  207.   *    ) echo "Sigh... Programmer error in $ME at line 128." ;;
  208. esac 
  209. case $TM in
  210.   true )
  211.     echo "would have issued commands:"
  212.     echo "$MA -s "$SU - part n of m" $TO" 
  213.     echo "with n ranging from 1 to m; m cannot be determined."
  214.     echo "without running for real."
  215.     exit 0 ;;
  216. esac 
  217.  
  218. n=1
  219. set $T3*
  220. for f  do
  221.   SE=false
  222.   case $RA in
  223.     all)  SE=true ;;
  224.     *  )
  225.       for p in $RA ; do
  226.         case $p in
  227.           $n ) SE=true ;;
  228.         esac
  229.       done ;;
  230.   esac
  231.   case $SE in
  232.     true)
  233.     {
  234.     echo " "
  235.     case $n in
  236.     1)
  237.       if test ! -s $f ; then
  238.         case $DB in 
  239.           [5-9]) echo "...whoops!  $SP failed!   Punting..." 1>&2 ;;
  240.         esac 
  241.         exit 1 ;
  242.       fi
  243.       echo "[The attached script will glue these mail messages together,"
  244.       echo "uuencode, uncompress, and extract all the files.  Be sure"
  245.       echo "to send the pieces through this script in the proper order!"
  246.       echo " "
  247.       echo "#! /bin/sh"
  248.       echo "echo extracting data..."
  249.       echo "/bin/awk '"
  250.       echo "BEGIN { inhex = 0 ; part = 0 }"
  251.       echo "/^---/ {"
  252.       echo "  if (\$2 == \"start\") part++"
  253.       echo "  if (\$6 != part) exit 1"
  254.       echo "  if (inhex && (NF > 1))"
  255.       echo "    inhex = 0"
  256.       echo "  else {"
  257.       echo "    inhex = 1"
  258.       echo "    getline"
  259.       echo "  }"
  260.       echo "}"
  261.       echo "{ if (inhex) print \$0 }'  > /tmp/xtr\$\$"
  262.       echo ""
  263.       echo " if test \$? = 1 ; then"
  264.       echo "   echo 'Parts sent through out of order!! Punting.'"
  265.       echo "   /bin/rm -f /tmp/xtr\$\$"
  266.       echo "   exit 1"
  267.       echo " fi"
  268.       echo ""
  269.       echo "echo ...finished extraction, starting uudecode..."
  270.       echo "fname=\`head -100 /tmp/xtr\$\$ | grep begin | cut -f3 -d' '\`"
  271.       echo "OurDir=\`pwd\`"
  272.       echo "cd /tmp"
  273.       echo "$UU xtr\$\$"
  274.       echo "/bin/rm -f xtr\$\$"
  275.       echo "/bin/chmod  777 \$fname"
  276.       echo "mv \$fname \$fname.Z"
  277.       echo "echo ...finished uudecode, starting uncompress..."
  278.       echo "uncompress \$fname"
  279.       echo "mv \$fname \$OurDir"
  280.       echo "cd \$OurDir"
  281.       echo "echo ...finished uncompress, starting tar extraction..."
  282.       echo "$TA xvf \$fname"
  283.       echo "/bin/rm -f /tmp/xtr* \$fname"
  284.       echo " " ;;
  285.     esac
  286.     echo " "
  287.     echo "This file was packed by mailsplit version:"
  288.     echo $VE
  289.     echo with command:
  290.     echo "$CM"
  291.     echo "on: `date`"
  292.     echo " "
  293.     echo "--- start of $SU part $n of $#"
  294.     cat $f
  295.     echo "--- end of $SU part $n of $#"
  296.     echo " "
  297.     echo " "
  298.     } | $MA $MF -s "$SU - part $n of $#" $TO
  299.     case $DB in
  300.       [5-9])   echo "...sent part $n of $# to $MA..." ;;
  301.     esac
  302.     case $DB in
  303.       5|6|7|8|9) echo "...sleeping $DE seconds (waiting for mailer) ..." ;;
  304.     esac
  305.     sleep $DE ;;
  306.   esac
  307.   n=`expr $n + 1`
  308. done
  309. /bin/rm -f $T1 $T2 $T3*
  310. SHAR_EOF
  311. fi
  312. if test -f 'mailsplit.1'
  313. then
  314.     echo shar: "will not over-write existing file 'mailsplit.1'"
  315. else
  316. cat << \SHAR_EOF > 'mailsplit.1'
  317. .\" @(#)mailsplit.1    2.1   88/07/25
  318. .nr N 24
  319. .nr D 5
  320. .TH MAILSPLIT 1 Local
  321. .UC 4
  322. .SH NAME
  323. mailsplit \- package, split, transmit file directories by electronic mail
  324. .SH SYNOPSIS
  325. .B mailsplit 
  326. [
  327. .B options
  328. .B mail-path files
  329. .br
  330.   really:
  331. .br
  332. .B mailsplit
  333. [
  334. .B \-Vntv
  335. ] [
  336. .B \-C compress program
  337. ] [
  338. .B \-D temporary directory
  339. ] [
  340. .B \-M Mailer options
  341. ] [
  342. .B \-T archive program
  343. ] [
  344. .B \-d delay time
  345. ] [
  346. .B \-l split lines
  347. ] [
  348. .B \-m mail agent
  349. ] [
  350. .B \-r parts
  351. ] [
  352. .B \-s subject
  353. ] [
  354. .B \-xn set debug-level n
  355. ] [
  356. .B \-u ascii encode program
  357. ]
  358. .I mail-path[,mailpath] 
  359. .I files [files] ...
  360. .SH DESCRIPTION
  361. .\" ---------------------------------------------------------------
  362. .\" This defines appropriate quote strings for nroff and troff
  363. .ds lq \&"
  364. .ds rq \&"
  365. .if t .ds lq ``
  366. .if t .ds rq ''
  367. .\" Just in case these number registers aren't set yet...
  368. .if \nN==0 .nr N 10
  369. .if \nD==0 .nr D 5
  370. .\" ---------------------------------------------------------------
  371. .I Mailsplit
  372. is a program to package, compress, document, transmit, and re-assemble
  373. multiple files and directories to other users via electronic mail.
  374. Mailsplit uses tar(1), compress(1), split(1) and mail(1) to send the files,
  375. and awk(1) to re-assemble them at the receiving side.  Mailsplit attempts to
  376. preserve the integrity, structure, mode, protection, and ownership of the
  377. transmitted directories.
  378. .SH OPTIONS
  379. Command line options can be used to override the default options in the source
  380. code of
  381. .I mailsplit.
  382. Options and flags can be specified in any order on the command line.
  383. The first non-option or flag token on the command line is interpretted
  384. to be the mail path whither the data should be sent.  All other
  385. non-option or flag tokens are considered files or directories to be
  386. sent.  Since the program is a shell-script, users might want to tune
  387. the defaults for their sites.  All suggestions, improvements,
  388. bug-reports, etc. would be greatly appreciated.  Send them to
  389. wyle@ethz.uucp.
  390. .IP -V
  391. sets the 
  392. .I verbose 
  393. option, and is equivilant to -x9 (maximum debugging).  When this option is
  394. set,
  395. .I mailsplit
  396. will echo everything he does while he's doing it.  This option will generate
  397. an awful lot of useless debugging information and is not recommended unless
  398. you are debugging.
  399. .IP -n
  400. puts
  401. .I mailsplit
  402. into "test" mode.  This mode is analogous to make(1) -n where
  403. .I mailsplit
  404. tells you which commands he would have issued without actually doing anything.
  405. This mode is also good for debugging, or when you're curious what mailsplit
  406. might do with a complicated path or directory.
  407. .IP -t
  408. same as -n
  409. .IP -v
  410. displays version number and exits.  This option is useful only for finding out
  411. which version / patch level your mailsplit is.
  412. .IP -C compress program
  413. tells
  414. .I mailsplit
  415. to use the next argument as the program to use instead of compress(1)
  416. for compressing the archive stream.  In some circumstances, using
  417. compress(1) may expand the size of a stream, in which case one would
  418. might want to use cat(1) to send the archive through unchanged.  The author is
  419. dubious of this option.
  420. .IP -D directory
  421. instructs
  422. .I mailsplit
  423. to use
  424. .I directory
  425. instead of /tmp for temporary files created during the archival, compression,
  426. and encoding process.  This option is necessary if there is very little space
  427. in /tmp, one is sending very large directories, or the file tree on this
  428. system is bizare.
  429. .IP -M mailer options
  430. When this option is used,
  431. .I mailsplit
  432. passes the
  433. .I mailer options
  434. argument(s) to the mail program.  Some mailers need options to get the job
  435. done (we won't mention an infamous X.400 mailer).  Other times, one would
  436. prefer to set options for efficiency, tell the mailer not to run
  437. interactively, etc.  To set more than one option, enclose
  438. .I mailer options
  439. in quotes.  Be careful about the shell's eating quotes.  One might have to
  440. experiment a bit to set all the options needed or desired. 
  441. .IP -T archive program
  442. If this option is set,
  443. .I mailsplit
  444. uses
  445. .I archive program
  446. instead of tar(1) to archive all the files and directories.  If the system
  447. does not have tar(1), it is unlikely that
  448. .I mailsplit
  449. will work.  On the other hand, tar(1) expands binary files enormously, so one
  450. might substitute cat(1) instead of tar(1) to reduce the size of the archive.
  451. .IP -d seconds
  452. tells
  453. .I mailsplit
  454. to wait
  455. .I seconds
  456. seconds after each time he invokes the mailer.  Some mailers (a certain
  457. X.400 system with "MTA congestion problems" will remain nameless) have
  458. problems dealing with sudden, large bursts of messages.  One might want
  459. to set the default in the code to some non-zero value if the mailer on
  460. his system has such problems.  If
  461. .I mailsplit
  462. is usually used for small directories, and the default delay is small,
  463. one should use this flag to set the delay higher if a large number of files or
  464. large directory is sent.
  465. .IP -l lines
  466. This option sets the maximum number of lines for a single mail
  467. message.  The default as distributed is set to keep a message smaller
  468. than 60 Kilobytes.  See the discussion below.  One might want to set
  469. the default higher, and use this option to set a smaller number when
  470. sending mail through mailers which don't like large messages.  (A
  471. certain X.400 mailer...)  Remember that if the archive pieces have to pass
  472. .I through
  473. a mailer which wants small messages, the lines size must be set smaller.
  474. .IP -m mailer
  475. If the system on which
  476. .I mailsplit
  477. is running has more than one mailer (user agent) one can use this flag
  478. to choose a mailer other than the default (/usr/ucb/Mail as
  479. distributed).  
  480. .IP -r parts
  481. The -r(esend) option is used to re-send pieces which became lost in the
  482. wide-area mail networks.
  483. .I parts
  484. is a list of pieces to be re-sent to the recipient.
  485. .I Parts
  486. can be a comma-separated list, or numbers between dashes, or just one number
  487. and a dash, or any combination.  The formal BNF of
  488. .I parts
  489. is:
  490. .nf
  491. .br
  492.  
  493. parts :== <number>
  494.       |   number,parts
  495.       |   number-number
  496.       |   number-
  497.  
  498. number:== <digit>
  499.       |   <digit><number>
  500.  
  501. digit :== 0|1|2|3|4|5|6|7|8|9
  502.  
  503. .br
  504. .fi
  505. Only those pieces in
  506. .I parts
  507. will be sent.  This option is useful for re-transmitting part 3 of 27 instead
  508. of having to re-transmit all 27 pieces.  One must be sure that the other
  509. options are set
  510. .I exactly the same
  511. as the first transmission, including line-length, etc.
  512. .IP -s subject
  513. sets the subject to
  514. .I subject
  515. instead of using the first file argument for the subject of each mail message
  516. generated.
  517. .IP -xn
  518. sets the debugging level to n, where n is a number from 0 to 9.  The higher
  519. the number, the more debug output.  Setting n to 0 causes
  520. .I mailsplit
  521. to work silently.  No output will be sent to standard out, and only failure
  522. messages will be sent to standard error.  Setting n to 9 is equivilant to -V
  523. (verbose), and gives maximum debug output.
  524. .IP u encoding program
  525. This option sets the encoding program to something other than
  526. uuencode(1c).  The encoding program must be able to take 8-bit binary
  527. and produce 7-bit ASCII data.
  528. .SH DISCUSSION
  529. .PP
  530. A few
  531. .I de
  532. .I facto
  533. standards have evolved on wide-area (e-mail) networks to guarantee the safe
  534. transmission of information:
  535. .sp
  536. .IP -
  537. The information must be text-only, i.e. 7-bit ASCII
  538. .IP -
  539. Lines of text may not exceed 80 characters.  A message must therefore
  540. contain an end-of-line character at least after every 80 characters.
  541. .IP -
  542. A single message may not exceed 64 Kilobytes.
  543. .IP -
  544. Lines of text starting with the word "From" will be translated
  545. to ">From."
  546. .IP -
  547. Blank lines at the end of a mail message are deleted.
  548. .IP -
  549. A message containing a period "." on a line by itself will be terminated
  550. abnormally.
  551. .PP
  552. Upon invocation, the program parses all flags and options, then looks
  553. for at least two parameters on the command line:  The e-mail path(s) of
  554. the receiver(s), and the file or directory name(s) to send.  If one or
  555. both of these parameters is missing, a help message is displayed with a
  556. short "usage" description and an example.
  557. .PP
  558. The directories or files are recursively archived and compressed into a
  559. temporary binary file.  The binary file is then sent through uuencode
  560. so that it is encoded into 7-bit ASCII with end-of-lines every 79
  561. characters.  The resulting ASCII file is then split into several
  562. different files, each of which is smaller than 64 Kilobytes.
  563. .PP
  564. The first file is prepended with instructions as well as the program
  565. needed to unpackage the transmitted message or messages.  All messages
  566. are pre- and post-pended with special start and end text, to assist both
  567. the person receiving the message and the unpackaging program.  Finally,
  568. each message is sent via electronic mail to the recipient, and all
  569. temporary files are deleted.
  570. .PP
  571. During these operations, status information is displayed after each
  572. successful step.  If there are no files to send, an error message is
  573. displayed.
  574. .PP
  575. At the receiving end, a first-time user must extract the unpackaging
  576. program from the first e-mail message, and make the program available
  577. for his use.  A user must perform this step only once, as the packaging
  578. format should not change.  Depending on the size of the transmitted files
  579. or directories, the receiver may get one or several mail messages.  The
  580. messages contain subject headers of the form:
  581. .br
  582. .\" .nf
  583. .sp
  584. "--- start of <package> part <n> of <m>"
  585. .sp
  586. .br
  587. where <package> is the first file or directory name, <m> is the total
  588. number of messages into which the package was split, and <n> is in the
  589. range 1 to m.
  590. .PP
  591. The receiver must then send all of the parts through the unpackaging
  592. program in their proper order.  This is accomplished either from within
  593. the mail reading program, or by saving the messages into a file and
  594. invoking the unpackaging program on the saved file.  Because e-mail
  595. systems will often deliver messages out of order, a warning is included
  596. to send the messages through the unpackaging program in the correct
  597. order.  The re-assembley program also detects this error and exits
  598. with an error status if the pieces are sent through out of order.
  599. .SH EXAMPLES
  600. .LP
  601. % mailsplit wyle@ethz.uucp /etc/hosts
  602. .LP
  603. % mailsplit wyle@ethz.uucp sources -r 5,7,17-21
  604. .LP
  605. % mailsplit -l 700 -x9 wyle@ethz.uucp goodies -s "examples"
  606. .LP
  607. % mailsplit -l 700 -x9 -r 19- wyle@ethz.uucp goodies
  608.  
  609. .SH AUTHOR
  610. Mitchell F. Wyle  (wyle@ethz.uucp)
  611. .SH BUGS
  612. .LP
  613. BSD specific?
  614. .LP
  615. Re-assembler should accept pieces out of order
  616. .LP
  617. Should be packaged with a configurer, makefile, install script
  618. .SH "SEE ALSO"
  619. split(1), tar(1), mail(1), uuencode(1), uudecode(1), compress(1),
  620. awk(1), sh(1)
  621. SHAR_EOF
  622. fi
  623. if test -f 'undoc'
  624. then
  625.     echo shar: "will not over-write existing file 'undoc'"
  626. else
  627. cat << \SHAR_EOF > 'undoc'
  628. Since I tore the comments out of the code, and it is not customary to send
  629. SCCS files around the net, I made this auxiliary file of documentation.
  630.  
  631. An alphabetical list of variables, their use and meaning:
  632.  
  633. AR = argument
  634. CM = command line
  635. CO = compress program may be arc, etc.
  636. DB = Debug level (Verbosity level)
  637. DE = Delay between pieces
  638. FC = file count
  639. FL = File list (build up file list from params on command line in
  640. FL = any order (see /usr/bin/spell) for a good example of obfuscated,
  641. FL = clever parsing code 
  642. LI = the number of lines to split pieces into
  643. MA = mail transport agent
  644. ME = the name of the program running
  645. MF = Mail flags to send to transport
  646. R  = range of pieces to be re-sent during parse stage
  647. RA = range of pieces to be re-sent if mailers on the way failed
  648. SE = send flag; if true, send the piece.  If false, don't
  649. SP = the name of the split program
  650. SU = subject of message  (defaults to first file name)
  651. T1 = temporary file containing output of tar and compress.
  652. T2 = temporary file containing uuencoded stuff
  653. T3 = temporary file(s) containing  split pieces
  654. TA = tar program (may be shar, tar, cat, etc ;-)
  655. TD = Temporary directory in which temp files should go can be . or /tmp.
  656. TM =  Test-mode flag (-n option of make)  Don't do anything, just
  657. TM = echo what you would have done if testmode option not on.
  658. TO = recipient(s) of message
  659. UU = the uuencode program (may be replaced with btoa / atob ;-)
  660. VE = version number
  661. f  = file name (piece) during loop which sends pieces
  662. i  = a loop index used during parse of the range of files to be re-sent
  663. max=  The loop-limit used in parse of range of files to be re-sent
  664. max= is assumed to be 99 if no top-of-range is given.
  665. n  = piece number during the loop which sends pieces via mail
  666. ne =  next param on command line (after flag is set, next param gets
  667. ne = eval'd to the var set in ne  (see above)
  668. t  = a specific token containing a range to be expanded (n-m)
  669. tok= Token during parse of range of files to be re-sent
  670.  
  671.  
  672. History:
  673. # Coder        Date      Comments
  674. #------------  -------- ---------------------------------------------------
  675. # M F Wyle     02nov87    Shamelessly stolen from tarmail :-)
  676. # WRU          18feb88    changed variable MAILER, added SPLITTER,
  677. #                         LINES, USER and a warning about uudecode
  678. # M F Wyle     25mar88    Add tar, extract join-script in 1st msg
  679. # WRU          03apr88  fixed some quoting problems in "echo"-strings
  680. #            cosmetic changes: renamed "mailsplit"
  681. #            created THISNAME
  682. #                       fixed some typos, added Email-addresses, example,
  683. #                       section for suggested improvements
  684. # MFW          05apr88  Fix more quoting problems in echo strings (shell
  685. #                       variables); added /bin/rm cleanup to join-script
  686. # MFW          21jun88  based on WRU's suggestions:
  687. #                       1) add file-name to subject
  688. #                       2) verbose explanations
  689. #                       3) add parts-order checking!  Yippeee!
  690. # MFW          08jul88  Fix uudecode setuid bug
  691. # MFW          12jul88  Fix empty or no files bug, added FILECOUNT
  692. # MFW          17jul88  Added umask 0, delay before mail, check after split
  693. # MFW          19jul88  Major re-write for flags, verbose, sccs control
  694. # MFW          25jul88  Added a range-parser, more flags, some documentation
  695. #                       Up'd release to 2.0 for distribution
  696.  
  697. Verbal description of algorithm:
  698. ====== =========== == ==========
  699. When the program starts, it initializes some variables, then parses the
  700. entire command line.  It builds up a list of non-flag options in the F
  701. variable.  The first parameter in F is the e-mail path.  All others are
  702. files or directories.
  703.  
  704. If no subject is set via the "-s subject"  flag, the subect is assigned
  705. from the first file to send.  The three temporary file names (variables
  706. T1, T2, and T3) are then assigned.
  707.  
  708. The range of pieces to be re-sent is parsed.
  709.  
  710. Debugging output is echo'd to standard out as appropriate for the
  711. debugging level.  If the -t or -n option is set, nothing is really
  712. done, except printing out what would have happened.
  713.  
  714. The tar, compress, split commands are performed, with appropriate
  715. verbosity for the debugging level.  Certain checks are made along the
  716. way to verify that the commands did not fail.  If one fails, the
  717. program exits with an appropriate failure message.
  718.  
  719. The files created in $T3* are sent via mail one at a time, with
  720. delays.  The first file sent has a join-script pre-pended.  A file
  721. counter $n is used to label the subject lines.
  722.  
  723. The temporary files are deleted.
  724.  
  725. SHAR_EOF
  726. fi
  727. exit 0
  728. #    End of shell archive
  729.  
  730. -- 
  731. -Mitchell F. Wyle            wyle@ethz.uucp
  732. Institut fuer Informatik     wyle%ifi.ethz.ch@relay.cs.net
  733. ETH Zentrum                  
  734. 8092 Zuerich, Switzerland    +41 1 256-5237
  735.